import { getSelectMap, getSelectMapTemp, getCreateNames,
     getSelectMapTemp2, getFileUrl, removeTempFiles } from './../fetch/modules/common'

export default {
    FETCH_MAP_DATA: ({ commit, state }, opt) => {
        return getSelectMap(opt).then(mapdata => commit('GET_SELECT_MAP_DATA', { mapdata }))
    },
    FETCH_MAP_DATA_TEMP: ({ commit, state }, opt) => {
        return getSelectMapTemp(opt).then(mapdata => commit('GET_SELECT_MAP_DATA_TEMP', { mapdata }))
    },
    FETCH_MAP_DATA_TEMP2: ({ commit, state }, opt) => {
        return getSelectMapTemp(opt).then(mapdata => commit('GET_SELECT_MAP_DATA_TEMP2', { mapdata }))
    },
    FETCH_MAP_DATA_TEMP3: ({ commit, state }, opt) => {
        return getSelectMapTemp(opt).then(mapdata => commit('GET_SELECT_MAP_DATA_TEMP3', { mapdata }))
    },
    FETCH_CREATE_NAME: ({ commit, state }) => {
        return getCreateNames().then(namedata => commit('GET_CREATE_NAMES', { namedata }))
    },
    FETCH_FILE_URL: ({ commit, state }, opts) => {
        return getFileUrl(opts).then(file => commit('GET_FILE_URL', { file }))
    },
    REMOVE_TEMP_FILE: ({ commit, state }, opts) => {
        return removeTempFiles(opts).then(refile => commit('FETCH_REMOVE_TEMP_FILE', { refile }))
    }
}